export default{
	namespaced:true,
	state:function(){
		return { 
			address:JSON.parse(uni.getStorageSync("address") || "{}"),
			token:'',
			userInfo:JSON.parse(uni.getStorageSync("userInfoMsg") || "{}")
		}
	},
	mutations:{
		updateAddress(state,address){
			state.address=address
			this.commit('m_user/saveAddressToStorage')
		},
		saveAddressToStorage(state){
			uni.setStorageSync("address", JSON.stringify(state.address) )
		},
		updateUserInfo(state,userInfoMsg){
			state.userInfo=userInfoMsg
			this.commit('m_user/saveUserInfoStorage',userInfoMsg)
		},
		saveUserInfoStorage(state,userInfoMsg){
			uni.setStorageSync(
				"userInfoMsg",JSON.stringify(userInfoMsg)
			)
		}
	},
	getters:{
			addstr(state){
				if(state.address.provinceName){
						return `${state.address.provinceName}${state.address.cityName}${state.address.countyName}${state.address.detailInfo}`
				}
				else {
					return ''
				}
		}
	}
	
}